home *** CD-ROM | disk | FTP | other *** search
/ Atlas of Florida / Atlas of Florida.iso / Movies / 1.0 Introduction / 1.0 Introduction / 00001_Script_1 next >
Text File  |  1994-08-23  |  8KB  |  289 lines

  1. --
  2. --  Movie scripts version 1.3  -  6/7/94
  3. --  All scripts written by David May.
  4. --
  5.  
  6. on startMovie
  7.   
  8.   openXlib "PrintField XCMD"
  9.   openResFile "Atlas.rsrc"
  10.   readGlossary "Glossaries:1.0 glossary"
  11.   
  12.   set the keyDownScript = "checkKey"
  13. end startMovie
  14.  
  15.  
  16. on stopMovie
  17.   closeXlib "PrintField XCMD"
  18.   closeResFile "Atlas.rsrc"
  19. end stopMovie
  20.  
  21.  
  22. on checkKey                                  -- Checks for command-key combinations
  23.   global textOpen, currentOpen, textChannel
  24.   
  25.   if (the key = "p") and (the commandDown) and textOpen then
  26.     if currentOpen <> 0 then set textChannel = currentOpen
  27.     put the castNum of sprite textChannel into theNum
  28.     printText theNum
  29.   end if
  30.   
  31. end checkKey
  32.  
  33.  
  34. on setupText text,def                        -- This sets up the global variables and hides the proper channels
  35.   global textOpen, defChannel, textChannel   --    when using a single popup text field and definition field
  36.   
  37.   if (text=0) and (def=0) then
  38.     set textOpen=false
  39.     showChannel textChannel
  40.     showChannel defChannel
  41.   else
  42.     showChannel textChannel
  43.     showChannel defChannel
  44.     set textOpen = false
  45.     set textChannel = text
  46.     set defChannel = def
  47.     hideChannel textChannel
  48.     hideChannel defChannel
  49.   end if
  50.   
  51. end setupText
  52.  
  53.  
  54. on multiText  which                          -- This code handles multiple text fields on a page
  55.   global currentOpen, textOpen
  56.   
  57.   if currentOpen = which then
  58.     hideChannel which
  59.     updateStage
  60.     set currentOpen = 0
  61.     set textOpen = false
  62.     exit
  63.   end if
  64.   
  65.   if currentOpen <> 0 then hideChannel currentOpen
  66.   
  67.   showChannel which
  68.   set currentOpen = which
  69.   set textOpen to true
  70. end multiText
  71.  
  72.  
  73. on newMultiText  which, sndButt, sndwhich         -- This code handles multiple text AND sounds
  74.   global currentOpen, textOpen, soundOpen, buttOpen
  75.   
  76.   
  77.   if currentOpen = which then
  78.     set the movieRate of sprite soundOpen to 0
  79.     hideChannel which
  80.     hideChannel sndButt
  81.     clearCursor sndButt
  82.     --updateStage
  83.     set buttOpen = 0
  84.     set currentOpen = 0
  85.     set soundOpen = 0
  86.     set textOpen = false
  87.     exit
  88.   end if
  89.   
  90.   if currentOpen <> 0 then
  91.     set the movieRate of sprite soundOpen to 0
  92.     hideChannel currentOpen
  93.     hideChannel buttOpen
  94.     clearCursor buttOpen
  95.   end if
  96.   
  97.   showChannel which
  98.   showChannel sndButt
  99.   setCursor sndButt
  100.   set currentOpen = which
  101.   set buttOpen = sndButt
  102.   set soundOpen = sndWhich
  103.   set textOpen to true
  104. end newMultiText
  105.  
  106.  
  107. on readText filename                         -- Reads in a text file "fileName" into "the result"
  108.   
  109.   set filename = the pathName & filename     -- Use the pathname of the movie + the desired name
  110.   set file = FileIO(mNew, "read", fileName)  -- Create a new instance of the FileIO XObject
  111.   
  112.   
  113.   if not objectp(file) then                  -- If the file couldn't be opened then exit gracefully.
  114.     return ""                                -- To do error checking, put a value in here
  115.   end if
  116.   
  117.   set s = file(mreadfile)                    -- Use our new object to read in the file
  118.   file(mDispose)                             -- Dispose of our file object
  119.   
  120.   if s <> "" then                            -- If there was any text in the file,
  121.     return s
  122.   else
  123.     return ""
  124.   end if
  125. end readText
  126.  
  127.  
  128. on writeText fileName, theField              -- Writes out a text file containing the contents of "theField"
  129.   
  130.   set file = FileIO(mNew, "?write", fileName)
  131.   
  132.   if not objectp(file) then
  133.     return false    
  134.   else    
  135.     set s = the text of field theField
  136.     file(mWriteString,s)    
  137.   end if
  138.   
  139.   file(mDispose)
  140.   
  141. end writeText
  142.  
  143.  
  144. on printText theField                        -- Prints out the text field with castNum of "theField"
  145.   
  146.   set aName = CallBackTracer(mNew)
  147.   SetCallBack PrintDoc, aName
  148.   
  149.   --parameter strings
  150.   set PageHeader = ""
  151.   set container = the text of cast theField
  152.   set PrintDialogString = ""
  153.   set FontName = "times"
  154.   set FontSize = "12"
  155.   set BooleanSetUp = "true"
  156.   
  157.   --command line
  158.   PrintDoc PageHeader, container, PrintDialogString, FontName, FontSize, BooleanSetUp
  159.   
  160.   
  161.   --this factory to bypass some message form the XCMD
  162. factory CallBackTracer
  163.   
  164. method mNew
  165. method mSendHCMessage x
  166. method mSendCardMessage x
  167.   
  168. end printText
  169.  
  170.  
  171. on readGlossary glossFile                    -- Reads in a glossary file into the global "gGlossary"
  172.   global gGlossary
  173.   readText glossFile
  174.   if (the result = "") then                  -- If an error occurred then,
  175.     alert "The glossary could not be found!" -- Display the appropriate error box.
  176.     put "" into gGlossary
  177.   else
  178.     put the result into gGlossary
  179.     return the result  
  180.   end if
  181. end readGlossary
  182.  
  183.  
  184. on readDefinition def                        -- Reads in the definition "def" from disk and puts it in the def. field
  185.   global defChannel
  186.   put the castNum of sprite defChannel into defField
  187.   readText "Definitions:" & def
  188.   if (the result = "") then                  -- If an error occurred then,
  189.     alert "The definition " & quote & def & quote & " could not be found!"
  190.     put empty into field defField
  191.     return false
  192.   else
  193.     put the result into field defField
  194.     return true
  195.   end if
  196. end readDefinition
  197.  
  198.  
  199. on waitForMouse
  200.   repeat while (not the mouseDown)           -- Loop until the mouse is clicked
  201.   end repeat
  202.   
  203.   openXLib "Johnny.xobj"                     -- Use the XObject "Johnny" to flush the event queue
  204.   set myFlush=johnny(mnew)                   -- so that Director won't recieve the mouse click
  205.   myflush(mflush)
  206.   myflush(mdispose)
  207.   closeXLib "Johnny.xobj"
  208. end waitForMouse
  209.  
  210.  
  211. on removePunc theWord                                        -- Will strip out the characters in "puncMarks" from "theWord"
  212.   
  213.   put ".!?,();:" & return & quote into puncMarks             -- faster this way
  214.   
  215.   put "" into newWord                                        -- Initialize our variable
  216.   
  217.   repeat with temp = 1 to (length(theWord))                  -- Repeat for all characters in the word
  218.     if not (puncMarks contains (char temp of theWord)) then  -- If the character isn't punctuation,
  219.       put char temp of theWord after newWord                 -- Copy it over to the new word
  220.     end if
  221.   end repeat
  222.   
  223.   return newWord                                             -- Return our new word, without punctuation
  224.   
  225. end removePunc
  226.  
  227.  
  228. on toggleChannel which                       -- Toggle the visibility of channel "which"
  229.   puppetSprite which,true
  230.   set the visibility of sprite which to (not the visibility of sprite which)
  231.   updateStage
  232.   puppetSprite which,false
  233. end toggleChannel
  234.  
  235.  
  236. on showChannel which                         -- Show the channel "which"
  237.   puppetSprite which,true
  238.   set the visibility of sprite which to true
  239.   --updateStage
  240.   puppetSprite which,false
  241. end showChannel
  242.  
  243.  
  244. on showAllChannels                           -- Show all channels
  245.   repeat with x = 1 to 48
  246.     puppetSprite x,true
  247.     set the visibility of sprite x to true
  248.     puppetSprite x,false
  249.   end repeat
  250. end showAllChannels
  251.  
  252.  
  253. on hideChannel which                         -- Hide the channel "which"
  254.   puppetSprite which,true
  255.   set the visibility of sprite which to false
  256.   --updateStage
  257.   puppetSprite which,false
  258. end hideChannel
  259.  
  260.  
  261. on clearCursors                              -- Will reset the cursor for all sprites to an arrow
  262.   repeat with x = 1 to 48
  263.     set the cursor of sprite x to 0
  264.   end repeat    
  265. end clearCursors
  266.  
  267.  
  268. on clearCursor which                         -- Will reset the cursor for sprite "which" to an arrow
  269.   set the cursor of sprite which to 0
  270. end clearCursor
  271.  
  272.  
  273. on setCursors whichOnes, curs                -- Will set the cursor of sprites "whichOnes" to a hand
  274.   -- Use the form "4,5,6" for whichOnes
  275.   clearCursors
  276.   
  277.   repeat with x = 1 to (the number of items in whichOnes)
  278.     put integer(item x of whichOnes) into i
  279.     set the cursor of sprite i to 5
  280.   end repeat
  281. end setCursors
  282.  
  283.  
  284. on setCursor which, curs                     -- Will se